<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of queryFeatures</title>
  <meta name="keywords" content="queryFeatures">
  <meta name="description" content="QUERYFEATURES used by DASMiner Browser for managing a DAS feature query">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">code</a> &gt; queryFeatures.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for code&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>queryFeatures
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>QUERYFEATURES used by DASMiner Browser for managing a DAS feature query</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function queryFeatures(hObject,handles) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> QUERYFEATURES used by DASMiner Browser for managing a DAS feature query
 
 SYNTAX: queryFeatures(handles)
          handles - handles of the DAS_GUI graphical objects

 See also <a href="das_gui.html" class="code" title="function varargout = das_gui(varargin)">DAS_GUI</a>

    DASMiner: DAS library and browser for Matlab.
    Diogo Veiga, March 2008.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="showinfowindow.html" class="code" title="function f = showinfowindow(msg,wtitle,handleDispGUI)">showinfowindow</a>	SHOWINFOWINDOW creates a small dialog window which displays a user-defined message.</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="das_gui.html" class="code" title="function varargout = das_gui(varargin)">das_gui</a>	DAS_GUI main GUI of DASMiner Browser</li></ul>
<!-- crossreference -->

<h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="#_sub1" class="code">function [featList,status] = getFeaturesSelection(handles)</a></li><li><a href="#_sub2" class="code">function [hDial] = openRunningDialog</a></li><li><a href="#_sub3" class="code">function setResultsFields(hObject,handles,xml,url)</a></li></ul>
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function queryFeatures(hObject,handles)</a>
0002 <span class="comment">% QUERYFEATURES used by DASMiner Browser for managing a DAS feature query</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% SYNTAX: queryFeatures(handles)</span>
0005 <span class="comment">%          handles - handles of the DAS_GUI graphical objects</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% See also DAS_GUI</span>
0008 <span class="comment">%</span>
0009 <span class="comment">%    DASMiner: DAS library and browser for Matlab.</span>
0010 <span class="comment">%    Diogo Veiga, March 2008.</span>
0011 
0012 
0013 <span class="keyword">if</span> (get(handles.popupmenu_SegDef,<span class="string">'Value'</span>) == 1)
0014     msgbox(<span class="string">'Define the segment type.'</span>,<span class="string">'Segment Type Requested'</span>,<span class="string">'warn'</span>);
0015     <span class="keyword">return</span>
0016 <span class="keyword">end</span>
0017 
0018 str = get(handles.popupmenu_SegDef,<span class="string">'String'</span>);
0019 val = get(handles.popupmenu_SegDef,<span class="string">'Value'</span>);
0020 dataType = str{val};
0021 
0022 <span class="keyword">if</span> (any(strcmpi(dataType,{<span class="string">'Chromosome'</span>,<span class="string">'Clone'</span>, <span class="string">'Contig'</span>, <span class="string">'NT_Contig'</span>, <span class="string">'Scaffold'</span>})) ) <span class="comment">%DNA segment</span>
0023 
0024     <span class="keyword">if</span> (isempty(get(handles.field_Chrom,<span class="string">'String'</span>)) || isempty(get(handles.field_Start,<span class="string">'String'</span>)) <span class="keyword">...</span>
0025             || isempty(get(handles.field_Stop,<span class="string">'String'</span>)) )
0026         msgbox(<span class="string">'Fill out the fields Chromosome, Start, Stop.'</span>,<span class="string">'Data Requested'</span>,<span class="string">'warn'</span>);
0027         <span class="keyword">return</span>
0028     <span class="keyword">end</span>
0029     
0030     <span class="keyword">if</span> (get(handles.popupmenu_FeatOptions2,<span class="string">'Value'</span>) == 1)
0031         msgbox(<span class="string">'Make a choice in the Options menu'</span>,<span class="string">'Data Requested'</span>,<span class="string">'warn'</span>);
0032         <span class="keyword">return</span>
0033     <span class="keyword">end</span>
0034 
0035     <span class="keyword">if</span> (get(handles.popupmenu_FeatOptions2,<span class="string">'Value'</span>) == 2) <span class="comment">%All features query</span>
0036         hDial = <a href="#_sub2" class="code" title="subfunction [hDial] = openRunningDialog">openRunningDialog</a>;
0037         [xmlS, xml,status,url] = executeDasCommand(handles.baseUrl,<span class="string">'command'</span>, <span class="string">'features'</span>, <span class="string">'DSN'</span>, handles.dsn ,<span class="string">'chrom'</span>,get(handles.field_Chrom,<span class="string">'String'</span>), <span class="keyword">...</span>
0038             <span class="string">'start'</span>,get(handles.field_Start,<span class="string">'String'</span>), <span class="string">'stop'</span>, get(handles.field_Stop,<span class="string">'String'</span>));
0039         <a href="#_sub3" class="code" title="subfunction setResultsFields(hObject,handles,xml,url)">setResultsFields</a>(hObject,handles,xml,url);
0040         delete(hDial);
0041         clear hDial;
0042 
0043     <span class="keyword">elseif</span> (get(handles.popupmenu_FeatOptions2,<span class="string">'Value'</span>) == 3) <span class="comment">%Specifying features query</span>
0044 
0045         [featList,okay] = <a href="#_sub1" class="code" title="subfunction [featList,status] = getFeaturesSelection(handles)">getFeaturesSelection</a>(handles);
0046 
0047         <span class="keyword">if</span> (~okay), <span class="keyword">return</span>; <span class="keyword">end</span>
0048         hDial = <a href="#_sub2" class="code" title="subfunction [hDial] = openRunningDialog">openRunningDialog</a>;
0049         [xmlS, xml,status,url] = executeDasCommand(handles.baseUrl,<span class="string">'command'</span>, <span class="string">'features'</span>, <span class="string">'DSN'</span>, handles.dsn ,<span class="string">'chrom'</span>,get(handles.field_Chrom,<span class="string">'String'</span>), <span class="keyword">...</span>
0050             <span class="string">'start'</span>,get(handles.field_Start,<span class="string">'String'</span>), <span class="string">'stop'</span>, get(handles.field_Stop,<span class="string">'String'</span>),<span class="string">'featuresList'</span>, featList);
0051         <a href="#_sub3" class="code" title="subfunction setResultsFields(hObject,handles,xml,url)">setResultsFields</a>(hObject,handles,xml,url);
0052         delete(hDial);
0053         clear hDial;
0054     <span class="keyword">end</span>
0055     
0056 <span class="keyword">else</span> <span class="comment">%ID definition</span>
0057 
0058     <span class="keyword">if</span> (isempty(get(handles.field_ID,<span class="string">'String'</span>)))
0059         msgbox(<span class="string">'Fill out ID'</span>,<span class="string">'Data Requested'</span>,<span class="string">'warn'</span>);
0060         <span class="keyword">return</span>
0061     <span class="keyword">end</span>
0062     
0063     <span class="keyword">if</span> (get(handles.popupmenu_FeatOptions,<span class="string">'Value'</span>) == 1)
0064         msgbox(<span class="string">'Make a choice in the Options menu'</span>,<span class="string">'Data Requested'</span>,<span class="string">'warn'</span>);
0065         <span class="keyword">return</span>
0066     <span class="keyword">end</span>
0067     
0068     <span class="keyword">if</span> (get(handles.popupmenu_FeatOptions,<span class="string">'Value'</span>) == 2) <span class="comment">%All features query</span>
0069         hDial = <a href="#_sub2" class="code" title="subfunction [hDial] = openRunningDialog">openRunningDialog</a>;
0070         [xmlS, xml,status,url] = executeDasCommand(handles.baseUrl,<span class="string">'command'</span>, <span class="string">'features'</span>, <span class="string">'DSN'</span>, handles.dsn ,<span class="string">'segment'</span>,get(handles.field_ID,<span class="string">'String'</span>));
0071         <a href="#_sub3" class="code" title="subfunction setResultsFields(hObject,handles,xml,url)">setResultsFields</a>(hObject,handles,xml,url);
0072         delete(hDial);
0073         clear hDial;
0074 
0075     <span class="keyword">elseif</span> (get(handles.popupmenu_FeatOptions,<span class="string">'Value'</span>) == 3) <span class="comment">%Specifying features query</span>
0076 
0077         [featList,okay] = <a href="#_sub1" class="code" title="subfunction [featList,status] = getFeaturesSelection(handles)">getFeaturesSelection</a>(handles);
0078 
0079         <span class="keyword">if</span> (~okay), <span class="keyword">return</span>; <span class="keyword">end</span>
0080         hDial = <a href="#_sub2" class="code" title="subfunction [hDial] = openRunningDialog">openRunningDialog</a>;
0081         [xmlS, xml,status,url] = executeDasCommand(handles.baseUrl,<span class="string">'command'</span>, <span class="string">'features'</span>, <span class="string">'DSN'</span>, handles.dsn ,<span class="string">'segment'</span>,get(handles.field_ID,<span class="string">'String'</span>), <span class="keyword">...</span>
0082             <span class="string">'featuresList'</span>, featList);
0083         <a href="#_sub3" class="code" title="subfunction setResultsFields(hObject,handles,xml,url)">setResultsFields</a>(hObject,handles,xml,url);
0084         delete(hDial);
0085         clear hDial;
0086 
0087     <span class="keyword">end</span>
0088     
0089 <span class="keyword">end</span>
0090 guidata(hObject,handles);
0091 
0092 <a name="_sub1" href="#_subfunctions" class="code">function [featList,status] = getFeaturesSelection(handles)</a>
0093 
0094 contents = get(handles.listbox_Feat,<span class="string">'String'</span>);
0095 ind = get(handles.listbox_Feat,<span class="string">'Value'</span>);
0096 nFeat = size(ind,2);
0097 
0098 featList = cell(nFeat,1);
0099 [featList{:}] = contents{ind};
0100 status = 1;
0101 
0102 featList = featList';
0103 
0104 
0105 <span class="keyword">if</span> ( (nFeat == 1) &amp;&amp; (ind(1)==1) )
0106     msgbox(<span class="string">'Choose the features for the query.'</span>,<span class="string">'Data Requested'</span>,<span class="string">'warn'</span>);
0107     status = 0;
0108     <span class="keyword">return</span>
0109 <span class="keyword">end</span>
0110 
0111 <a name="_sub2" href="#_subfunctions" class="code">function [hDial] = openRunningDialog</a>
0112 hDial = <a href="showinfowindow.html" class="code" title="function f = showinfowindow(msg,wtitle,handleDispGUI)">showinfowindow</a>({<span class="string">'Connecting to the server ...'</span>,<span class="string">'Running request...'</span>},<span class="string">'Please wait ...'</span>);
0113 set(hDial,<span class="string">'CloseRequestFcn'</span>,<span class="string">''</span>);
0114 t = get(hDial,<span class="string">'Position'</span>);
0115 set(hDial,<span class="string">'Position'</span>,t)
0116 
0117 <a name="_sub3" href="#_subfunctions" class="code">function setResultsFields(hObject,handles,xml,url)</a>
0118 
0119 set(handles.field_XMLDisp,<span class="string">'String'</span>,xml);
0120 handles.currentXML = xml;
0121 set(handles.field_queryURL,<span class="string">'String'</span>,url);
0122 handles.currentURL = url;
0123 guidata(hObject,handles);</pre></div>
<hr><address>Generated on Tue 17-Feb-2009 16:59:45 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>